﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpectrEngine.Framework.Collision
{
    public sealed class CollisionItem
    {
        public CollidableGameNode First;
        public CollidableGameNode Second;

        public CollisionItem(CollidableGameNode first, CollidableGameNode second)
        {
            this.First = first;
            this.Second = second;
        }

        public override int GetHashCode()
        {
            return First.GetHashCode() + Second.GetHashCode();
        }

        public bool Equals(CollisionItem other)
        {
            return (other.First.Equals(First) && other.Second.Equals(Second));
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, null))
            {
                return false;
            }

            if (ReferenceEquals(this, null))
            {
                return true;
            }

            if (obj.GetType() != typeof(CollisionItem))
            {
                return false;
            }

            return this.Equals((CollisionItem)obj);
        }

        public static bool operator ==(CollisionItem left, CollisionItem right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(CollisionItem left, CollisionItem right)
        {
            return !left.Equals(right);
        }
    }
}
